*
* Estimates on total household consumption and income
*
set varabbrev off, permanently
clear all
use epfipc2006-2019plus.dta
global listtotal gasto1-gasto12 year2-year13 ccaa2-ccaa18 income squaredm othehouse ///
       ttenure2-ttenure6 tsize2-tsize5 pdensity2-pdensity3 residshort nmembers nfemales ///
	   nforeign ndworkers n5_15 n16_24 n25_34 n35_64 n65_79 n80omas nstudies2-nstudies4 ///
	   nactive nincome labinc peninc uneinc capinc agemb femalemb foreignmb unemployedmb inactivemb 
		
foreach var1 in T21 T10 T01 T12 {
		* Trend plot expenditure
		
		bysort year: egen meantreated=mean(gastot) if `var1'==1
		bysort year: egen meanuntreated=mean(gastot) if `var1'==0
		twoway (line meantreated year, lcolor(red)) (line meanuntreated year, lcolor(black) ///
				 ytitle("Total Household Expenditure") xtitle(" ")), graphregion(fcolor(white)) ///
				 ylab(,nogrid) xlab(,nogrid) legend(off) title(Treatment `var1')  ///
				 xlabel(2006(4)2018) ylabel(5000(10000)45000) name(gasto`var1')
		drop meantreated meanuntreated	
		* Trend plot income
		bysort year: egen meantreated=mean(income) if `var1'==1
		bysort year: egen meanuntreated=mean(income) if `var1'==0
		twoway (line meantreated year, lcolor(red)) (line meanuntreated year, lcolor(black) ///
				 ytitle("Total Household Income") xtitle(" ")), graphregion(fcolor(white)) ///
				 ylab(,nogrid) xlab(,nogrid) legend(off) title(Treatment `var1') ///
				 xlabel(2006(4)2018) ylabel(5000(10000)45000) name(income`var1')
		drop meantreated meanuntreated
}
graph combine gastoT10 incomeT10 gastoT01 incomeT01 gastoT21 incomeT21 gastoT12 incomeT12 , col(2) row(4) xsize(6) ysize(10)
*graph export "Figure_Parallel_Trends.jpg", as(eps)


*
* Estimates on total household consumption and income per adult equivalent
*
clear all
use epfipc2006-2019plus.dta
global listtotalaeq gastoaeq1-gastoaeq12 year2-year13 ccaa2-ccaa18 income squaredm othehouse ///
       ttenure2-ttenure6 tsize2-tsize5 pdensity2-pdensity3 residshort nmembers nfemales ///
	   nforeign ndworkers n5_15 n16_24 n25_34 n35_64 n65_79 n80omas nstudies2-nstudies4 ///
	   nactive nincome labinc peninc uneinc capinc agemb femalemb foreignmb unemployedmb inactivemb

	   foreach var1 in T21 T10 T01 T12 {
		* Trend plot expenditure
		bysort year: egen meantreated=mean(gastotaeq)  if `var1'==1
		bysort year: egen meanuntreated=mean(gastotaeq) if `var1'==0
		twoway (line meantreated year, lcolor(red))  (line meanuntreated year, lcolor(black) ///
				 ytitle("Per Adult Expenditure") xtitle(" ")), graphregion(fcolor(white)) ///
				 ylab(,nogrid) xlab(,nogrid) legend(off) title(Treatment `var1')  ///
				 xlabel(2006(4)2018) ylabel(5000(5000)25000) name(gasto`var1')
		drop meantreated meanuntreated	
		* Trend plot income
		bysort year: egen meantreated=mean(incomeaeq) if `var1'==1 
		bysort year: egen meanuntreated=mean(incomeaeq) if `var1'==0
		twoway (line meantreated year, lcolor(red))  (line meanuntreated year, lcolor(black) ///
				 ytitle("Per Adult Income") xtitle(" ")), graphregion(fcolor(white)) ///
				 ylab(,nogrid) xlab(,nogrid) legend(off) title(Treatment `var1') ///
				 xlabel(2006(4)2018) ylabel(5000(5000)25000) name(income`var1')
		drop meantreated meanuntreated
}
graph combine gastoT10 incomeT10 gastoT01 incomeT01 gastoT21 incomeT21 gastoT12 incomeT12 , col(2) row(4) xsize(6) ysize(10)
*graph export "Figure_Parallel_Trends_aeq.jpg", as(eps)

*
* The End
*
